package com.vben.system.api.feign;

import com.vben.common.core.constant.ServiceNameConstant;
import com.vben.common.core.util.R;
import com.vben.common.feign.interceptor.FeignInterceptor;
import com.vben.system.api.entity.SysUserLoginLog;
import com.vben.system.api.feign.fallback.RemoteUserFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 用户登陆日志远程服务
 *
 * @author sunnfun
 */
@FeignClient(contextId = "remoteUserLoginLogService",
        value = ServiceNameConstant.SYSTEM_SERVICE,
        configuration = FeignInterceptor.class,
        fallbackFactory = RemoteUserFallbackFactory.class)
public interface RemoteUserLoginLogService {

    /**
     * 根据loginId查询登陆日志信息
     */
    @GetMapping("/loginLog/info/loginId/{loginId}")
    R<SysUserLoginLog> getByLoginId(@PathVariable("loginId") String loginId);

    /**
     * 新增登陆日志
     */
    @PostMapping("/loginLog")
    R<Boolean> addLoginLog(@RequestBody SysUserLoginLog sysUserLoginLog);

    /**
     * 更新登陆日志
     */
    @PutMapping("/loginLog")
    R<Boolean> updateLoginLog(@RequestBody SysUserLoginLog sysUserLoginLog);

}
